<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<script type="text/javascript" src="../javascripts/prototype.js"> </script>
	<script type="text/javascript" src="../javascripts/effects.js"> </script>
	<script type="text/javascript" src="../javascripts/window.js"> </script>
	<script type="text/javascript" src="../javascripts/debug.js"> </script>
	<link href="../themes/default.css" rel="stylesheet" type="text/css"/>
	<link href="../themes/alert.css" rel="stylesheet" type="text/css"/>
	<link href="../themes/lighting.css" rel="stylesheet" type="text/css"/>

	<title>dialog</title>
	
</head>

<body>
<a href="#" onclick="openNewItem('container')">open new item dialog, dialog content is filled by an ajax call</a><br/>
<a href="#" onclick="openNewItem()">open new item dialog, no update after close</a><br/>
<div id="container">old content</div>


<script type="text/javascript">
  var updateContainer = null;
  
  var reloadContainer = function () { 
  	if (updateContainer) 
  		$(updateContainer).innerHTML='new content';
  	updateContainer=null;
  }
  
  function openNewItem(container) {
  	  if (container) {
  	  	  updateContainer = container;
  	  	  onDestroyHandler = reloadContainer;
  	  } else {
  	  	  onDestroyHandler = null;
  	  }
      Dialog.info({url: "newitemform.html", options: {method: 'get'}}, 
                     {top: 10, width:250, className: "greylighting", 
                     destroyOnClose: true, onDestroy: onDestroyHandler })
  }
</script>

</body>
</html>
